﻿namespace Borg
{
    public class ExtensionPersistor
    {
        private readonly Extension _extension;
        private readonly Persistor _persistor;

        internal ExtensionPersistor(Persistor persistor, Extension extension)
        {
            _extension = extension;
            _persistor = persistor;
        }

        public void Save(string key, object value)
        {
            _persistor.Save(_extension, key, value);
        }

        public bool Restore<T>(string key, out T value)
        {
            return _persistor.Restore(_extension, key, out value);
        }

        public void Clear()
        {
            _persistor.Clear(_extension);
        }
    }
}
